package com.training.java.spring.web;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.training.java.spring.domain.Customer;

@Controller
public class CustomerController {
	
	@RequestMapping(value="/signup", method=RequestMethod.GET)
	public ModelAndView getForm()
	{
		Customer customer = new Customer();
		ModelAndView modelAndView = new ModelAndView();
		modelAndView.addObject("customer", customer);
		modelAndView.setViewName("signup");
		return modelAndView;
	}
	
	@RequestMapping(value="/signup", method=RequestMethod.POST)
	public String saveForm(Customer customer)
	{
		System.out.println("customer: " + customer.toString());
		return "Acknowledge";
	}
	

}
